package com.example.cms.Patients;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class Patient {
    private static Integer patientId;
    private String medicalRecordNo;
    private String name;
    private String idCard;
    private String gender;
    private LocalDate birthDate;
    private String phone;
    private String address;
    private String insuranceType;
    private String allergyHistory;
    private String emergencyContact;
    private String emergencyPhone;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;

 //    默认构造器
    public Patient() {
        this.createTime = LocalDateTime.now();
        this.updateTime = LocalDateTime.now();
    }

    // 带参数构造器
    public Patient(String name, String idCard, String gender, LocalDate birthDate, String phone, String address, String insuranceType) {
        this();
        this.name = name;
        this.idCard = idCard;
        this.gender = gender;
        this.birthDate = birthDate;
        this.phone = phone;
        this.medicalRecordNo = generateMedicalRecordNo();
        this.address = address;
        this.insuranceType = insuranceType;
    }


    private String generateMedicalRecordNo() {
        return "MR" + System.currentTimeMillis();
    }

    // Getter 和 Setter 方法
    public  Integer getPatientId() {
        return patientId;
    }

    public void setPatientId(Integer patientId) {
        this.patientId = patientId;
    }

    public String getMedicalRecordNo() {
        return medicalRecordNo;
    }

    public void setMedicalRecordNo(String medicalRecordNo) {
        this.medicalRecordNo = medicalRecordNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public LocalDate getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(LocalDate birthDate) {
        this.birthDate = birthDate;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getInsuranceType() {
        return insuranceType;
    }

    public void setInsuranceType(String insuranceType) {
        this.insuranceType = insuranceType;
    }

    public String getAllergyHistory() {
        return allergyHistory;
    }

    public void setAllergyHistory(String allergyHistory) {
        this.allergyHistory = allergyHistory;
    }

    public String getEmergencyContact() {
        return emergencyContact;
    }

    public void setEmergencyContact(String emergencyContact) {
        this.emergencyContact = emergencyContact;
    }

    public String getEmergencyPhone() {
        return emergencyPhone;
    }

    public void setEmergencyPhone(String emergencyPhone) {
        this.emergencyPhone = emergencyPhone;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "Patient{" +
                "patientId=" + patientId +
                ", medicalRecordNo='" + medicalRecordNo + '\'' +
                ", name='" + name + '\'' +
                ", idCard='" + idCard + '\'' +
                ", gender='" + gender + '\'' +
                ", birthDate=" + birthDate +
                ", phone='" + phone + '\'' +
                ", insuranceType='" + insuranceType + '\'' +
                '}';
    }
}